<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<style>
		/*#sent{*/
		/*	width: 100%;*/
		/*	height: 100%;*/
		/*	background-image: url(/static/秒速五厘米.jpg);*/
		/*	border: solid;*/
		/*	background-repeat:no-repeat;*/
		/*	*/
		/*	background-size: 100% 100%;*/
		/*}*/
		#yc{
			width: 500px;
    		height: 200px;
			padding:40px;
			margin:250px auto;
			background-color:#ccc;
			background-color: rgba(254,219,207,0.5);
			border-radius: 15px 15px 15px 15px;

			
			}
		input{
			margin-bottom: 28px;
    		width: 300px;
    		height: 37px;
    		margin-left: 82px;
		}
		#st{
			margin-left: 82px;
    		margin-bottom: 46px;
		}
		body{
        	background: url(/static/背景图.jpg);
        	background-repeat:no-repeat;
        	background-size: 100% 100%;
            background-attachment: fixed;
        }
	</style>
</head>
    <body>
        <div id='sent'>
	        <div id='yc'>

	        		<input id="dm"  type="text"  name="dm" placeholder="请输入账号"/><br>

					<input id="mm"  type="text"  name="mm" placeholder="请输入密码"/><br>

	        		<input id="st"  type="submit" value="注册"/>

	        </div>
        </div>
		<script src="/static/jquery-3.1.1.min.js"></script>
        <script>
			var dm = document.getElementById('dm');
			var mm = document.getElementById('mm');
			st.onclick = function () {
				if (dm.value != '' && dm.value.length <= 25) {
				$.ajax({
    				type: 'POST',
					async:false,
    				dataType: 'json',
    				contentType: 'application/json;charset=UTF-8',
    				data: JSON.stringify({
    				    "user": dm.value,
    				    "passwd": mm.value,
    				}),
    				url: '/user/zhuce',
    				success: function (data) {
						if(data.code==="400") {
							alert(data.msg);
						}
						else {
							alert(data.msg);
							window.location.href='http://localhost:8070/login'
						}

    				},
    				error: function(data) {
						console.log(data.msg);
						alert("error");
					}
				})
				}
				else {
					alert('输入不能超过25个字符!');
				}
			};
        </script>
    </body>
</html>